package org.dfzt.modules.online.cgform.converter.aa;

import java.util.List;
import java.util.Map;

import org.dfzt.common.system.vo.DictModel;
import org.dfzt.common.util.oConvertUtils;
import org.dfzt.modules.online.cgform.converter.FieldCommentConverter;


public class b
        implements FieldCommentConverter {
    protected String filed;
    protected List<DictModel> dictList;

    public String getFiled() {
        return this.filed;
    }


    public void setFiled(String filed) {
        this.filed = filed;
    }


    public List<DictModel> getDictList() {
        return this.dictList;
    }


    public void setDictList(List<DictModel> dictList) {
        this.dictList = dictList;
    }


    @Override
    public String converterToVal(String txt) {
        if (oConvertUtils.isNotEmpty(txt)) {
            for (DictModel dictModel : this.dictList) {
                if (dictModel.getText().equals(txt)) {
                    return dictModel.getValue();
                }
            }
        }
        return null;
    }


    @Override
    public String converterToTxt(String val) {
        if (oConvertUtils.isNotEmpty(val)) {
            for (DictModel dictModel : this.dictList) {
                if (dictModel.getValue().equals(val)) {
                    return dictModel.getText();
                }
            }
        }
        return null;
    }


    @Override
    public Map<String, String> getConfig() {
        return null;
    }
}
